<?php
class Reviewer {
	/** 采购需求 */
	const CLS_DEMAND	= 1;
	/** 采购订单 */
	const CLS_INDENT	= 2;
	/** 质检入库 */
	const CLS_QC		= 3;
	/** 领料需求 */
	const CLS_OUTDEMAND	= 4;
	
	const AUDIT_NONE	= 0;
	const AUDIT_PASS	= 1;
	const AUDIT_FAIL	= 2;

	static function get($id){
		return Db::get(__CLASS__)->select()->where(array('id'=>$id))->getOne();
	}

	static function add($data){
		return Db::get(__CLASS__)->insert($data)->exec()
				? Db::get(__CLASS__)->insertId() : null;
	}

    static function getList($where=array(), $order='id ASC', $s=0, $l=0)
    {
        return Db::get('_Reviewer')->select()->where($where)->order($order)->limit($s, $l)->hkey('id')->getAll();
    }

	static function count($where){
		return Db::get(__CLASS__)->count()->where($where)->getCol();
	}

	static function update($id, $data){
		return Db::get(__CLASS__)->update($data)->where(array('id'=>$id))->exec();
	}

	static function supports(){
		return array(1=>'Demand', 'Indent', 'Bound', 'Bound');
	}

}
?>
